to List
Wraps the provided values into a ValidatedList with this field as validation
Return
ValidatedList wrapping the provided values and this field as validation
Author
fzzyhmstrs
Since
0.2.0
Parameters
elements
the inputs for the list generation. Same type as this field
Samples
import me.fzzyhmstrs.fzzy_config.util.EnumTranslatable
import me.fzzyhmstrs.fzzy_config.validation.Shorthand.validated
import me.fzzyhmstrs.fzzy_config.validation.collection.*
import me.fzzyhmstrs.fzzy_config.validation.minecraft.ValidatedIdentifier
import me.fzzyhmstrs.fzzy_config.validation.misc.ValidatedBoolean
import me.fzzyhmstrs.fzzy_config.validation.misc.ValidatedString
import me.fzzyhmstrs.fzzy_config.validation.number.ValidatedInt
import net.minecraft.registry.RegistryKeys
import net.minecraft.util.Identifier
fun main() {
//sampleStart
//validated int list, with validation on entries restricting inputs to 1 to 16 (inclusive)
val validatedList = ValidatedList(listOf(1, 2, 4, 8), ValidatedInt(1..16))
//wraps the vararg valued provided with a blank validated field (identifiers in this case). validation with actual bounds and logic can of course be used too
val listFromFieldVararg = ValidatedIdentifier().toList(Identifier.of("stick"), Identifier.of("blaze_rod"))
//wraps the collection provided with a blank validated field (identifiers in this case). validation with actual bounds and logic can of course be used too
val listFromFieldCollection = ValidatedIdentifier().toList(listOf(Identifier.of("wooden_sword"), Identifier.of("stone_sword")))
//fields and sections have lang keys based on their "location" in the Config class graph.
//Lange key composition is as follows
//1. the namespace of the config id: (my_mod)
//2. the path of the config id: (my_mod.my_config)
//3. any parent ConfigSection field names as declared in-code: (my_mod.my_config.subSection)
//4. the setting field name as declared in-code: (my_mod.my_config.subSection.fieldName)
val fieldLang = """
{
"_comment1": "the lang for an example 'fieldName' setting in a config inside section 'subSection'",
"my_mod.my_config.subSection.fieldName": "Very Important Setting",
"my_mod.my_config.subSection.fieldName.desc": "This very important setting is used in this very important way."
}
"""
//sampleEnd
}
Wraps the provided collection into a ValidatedList with this field as validation
Return
ValidatedList wrapping the collection and this field as validation
Author
fzzyhmstrs
Since
0.2.0
Parameters
collection
the collection to wrap. Same type as this field
Samples
import me.fzzyhmstrs.fzzy_config.util.EnumTranslatable
import me.fzzyhmstrs.fzzy_config.validation.Shorthand.validated
import me.fzzyhmstrs.fzzy_config.validation.collection.*
import me.fzzyhmstrs.fzzy_config.validation.minecraft.ValidatedIdentifier
import me.fzzyhmstrs.fzzy_config.validation.misc.ValidatedBoolean
import me.fzzyhmstrs.fzzy_config.validation.misc.ValidatedString
import me.fzzyhmstrs.fzzy_config.validation.number.ValidatedInt
import net.minecraft.registry.RegistryKeys
import net.minecraft.util.Identifier
fun main() {
//sampleStart
//validated int list, with validation on entries restricting inputs to 1 to 16 (inclusive)
val validatedList = ValidatedList(listOf(1, 2, 4, 8), ValidatedInt(1..16))
//wraps the vararg valued provided with a blank validated field (identifiers in this case). validation with actual bounds and logic can of course be used too
val listFromFieldVararg = ValidatedIdentifier().toList(Identifier.of("stick"), Identifier.of("blaze_rod"))
//wraps the collection provided with a blank validated field (identifiers in this case). validation with actual bounds and logic can of course be used too
val listFromFieldCollection = ValidatedIdentifier().toList(listOf(Identifier.of("wooden_sword"), Identifier.of("stone_sword")))
//fields and sections have lang keys based on their "location" in the Config class graph.
//Lange key composition is as follows
//1. the namespace of the config id: (my_mod)
//2. the path of the config id: (my_mod.my_config)
//3. any parent ConfigSection field names as declared in-code: (my_mod.my_config.subSection)
//4. the setting field name as declared in-code: (my_mod.my_config.subSection.fieldName)
val fieldLang = """
{
"_comment1": "the lang for an example 'fieldName' setting in a config inside section 'subSection'",
"my_mod.my_config.subSection.fieldName": "Very Important Setting",
"my_mod.my_config.subSection.fieldName.desc": "This very important setting is used in this very important way."
}
"""
//sampleEnd
}